package tdd.t1;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

public class TaxiFeeCity {
	final static private Logger LOG = Logger.getLogger("TaxiFeeCity");	
	List<Charger> ch;
	FeeMgr feeMgr;
	TaxiFeeCity() {
		ch =  new ArrayList<Charger>();
	}
	
	public void add(Charger c) {
		ch.add(c);
	}
	
	public void remove(Charger c) {
		ch.remove(c);
	}
	
	public double operate(double miles, int time) {
		FeeMgr feeMgr = new FeeMgr(ch);
		try {
			return feeMgr.chargeByTime(miles, time);
		} catch  (Exception e) {
			LOG.info(getClass().getSimpleName() + " " + "input invliad para");			
			return 0;
		}
	}
	
	public double operate(double miles) {
		FeeMgr feeMgr = new FeeMgr(ch);
		try {
			return feeMgr.chargeByMiles(miles);
		} catch  (Exception e) {
			LOG.info(getClass().getSimpleName() + " " + "input invliad para");			
			return 0;
		}
	}
}
